﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ProjectWizardManagementv1.Infrastructure.Concrete;
using ProjectWizardManagementv1.WpfComponents.ComponentClasses;

namespace ProjectWizardManagementv1.WpfComponents.UserControls
{
    /// <summary>
    /// Interaction logic for ExcelEditor.xaml
    /// </summary>
    public partial class ExcelEditor : UserControl
    {
        public string DestinationPath { get; set; }
        private CellTextField[,] _grid;

        public ExcelEditor(CellTextField[,] grid)
        {
            InitializeComponent();
            _grid = grid;
        }

        private void ColorPicker_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color> e)
        {
            var color = ColorPicker.SelectedColor;
            foreach(var grid in _grid)
            {
                if(grid.IsFocused)
                    grid.Background = new SolidColorBrush(color);
            }
        }

        private void Save_SaveDocument(object sender, RoutedEventArgs e)
        {
            ExcelDocumentIO.SaveDocument(_grid, DestinationPath);
        }
    }
}
